﻿Shader "Custom/AlphaShader" {
	Properties 
	{
		_Color("Tint Color", Color) = (1.0,1.0,1.0,1.0)
		_Cutoff( "Cut Off", Range( 0, 1.0 )) = 1.0
		_Texture("Texture", 2D ) = "none"
	}
	
	SubShader 
	{
		Tags 
		{ 
			"Queue"="Transparent" 
		}
		
		ZWrite Off
		
		Blend SrcAlpha OneMinusSrcAlpha
		
		Pass
		{
		CGPROGRAM
		#pragma exclude_renderers ps3 xbox360
		#pragma fragmentoption ARB_precision_hint_fastest
		#pragma vertex vert
		#pragma fragment frag
		
		#include "UnityCG.cginc"
		
		uniform sampler2D _Texture;
		uniform float _Cutoff;
		uniform fixed4 _Color;
		
		struct vertexInput
		{
			float4 vertex : POSITION;
			//float4 tanget : TANGET;
			//float3 normal : NORMAL;
			float4 textureCoord0 : TEXCOORD0; 
			//fixed4 color : COLOR;
		};
		
		struct fragmentInput
		{
			float4 pos : SV_POSITION;
			float4 color : COLOR0;
			half2 uv : TEXCOORD0;
		};
		
		fragmentInput vert( vertexInput i )
		{
			fragmentInput o;
			
			o.pos = mul( UNITY_MATRIX_MVP, i.vertex );
			o.uv = i.textureCoord0;
			
			o.color = _Color;
			o.color.a *= _Cutoff;
			
			
			return o;
		}
		
		half4 frag( fragmentInput i ) : COLOR
		{
			return tex2D( _Texture, i.uv ) * i.color;
		}
		
		ENDCG		
		}
	} 
	FallBack "Diffuse"
}
